#include "stdafx.h"

namespace classifier_test
{

stagger_generator::stagger_generator()
{
	Scheme.resize(4);
	for (int I = 0; I < 4; I++) Scheme[I].type = discr_attr;
	Scheme[0].name = "color";
	Scheme[1].name = "shape";
	Scheme[2].name = "size";
	Scheme[3].name = "class";
	Scheme[0].discr.add("green");
	Scheme[0].discr.add("blue");
	Scheme[0].discr.add("red");
	Scheme[1].discr.add("triangle");
	Scheme[1].discr.add("circle");
	Scheme[1].discr.add("rectangle");
	Scheme[2].discr.add("small");
	Scheme[2].discr.add("medium");
	Scheme[2].discr.add("large");
	Scheme[3].discr.add("+");
	Scheme[3].discr.add("-");
}

stagger_generator::stagger_generator(const stagger_generator& Val)
	: conceptual_data_generator(Val)
{
	Scheme = Val.Scheme;
}

smart_ptr<conceptual_data_generator> stagger_generator::clone() const
{
	return make_smart_ptr(new stagger_generator(*this));
}

const record_scheme& stagger_generator::get_scheme() const
{
	return Scheme;
}

int stagger_generator::get_concept_count() const
{
	return 3;
}

void stagger_generator::generate(int Con, record& Rec) const
{
	Rec.resize(4);
	for (int I = 0; I < 3; I++) Rec[I].discr = rand() % 3;
	if (Con == 0)
		Rec[3].discr = 1 - int(Rec[0].discr == 2 && Rec[2].discr == 0);
	else if (Con == 1)
		Rec[3].discr = 1 - int(Rec[0].discr == 0 || Rec[1].discr == 1);
	else if (Con == 2)
		Rec[3].discr = 1 - int(Rec[2].discr == 1 || Rec[2].discr == 2);
}

}
